<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
     <p>
         整数1：<input type="text" id="new">
     </p>
     <p>
         整数2：<input type="text" id="new1">
     </p>
     <button onclick="change('a')">相加</button>
     <button onclick="change('b')">相减</button>
     <button onclick="change('c')">相乘</button>
     <button onclick="change('d')">相除</button>
     <p>
         结果：<input type="text" id="jg">
     </p>
<script>
      function change(e){
        var i = document.querySelector("#new").value;
          i = Number(i);
        var j = document.querySelector("#new1").value;
           j = Number(j);
          var arr = 0;
          switch (e){
              case 'a':
                  arr = i + j;
                  break;
              case 'b':
                  arr = i - j;
                  break;
              case 'c':
                  arr = i * j;
                  break;
              case 'd':
                  arr = i / j;
                  break;
          }
          document.querySelector("#jg").value = arr;
      }
</script>
</body>
</html>